import StatusEnum from '@/enums/StatusEnum'
import DrugFearBackTypeEnum from '@/enums/DrugFearBackTypeEnum'
import { search } from '/src/api/pharmacy/drug'

/**
 * @param label 表头
 * @param prop 字段名
 * @param isSearch 是否筛选项
 * @type {[{isSearch: boolean, prop: string, label: string},{isSearch: boolean, prop: string, label: string},{isSearch: boolean, prop: string, label: string},{isSearch: boolean, prop: string, label: string, enum: {0: string, 1: string, 2: string}}]}
 */
const tableColumn = [
  {
    label: 'ID',
    prop: 'id',
    isSearch: false,
    isTable: true
  },
  {
    label: '药品名称',
    prop: 'drug_id',
    isTable: true,
    isForm: true,
    formType: 'select_remote',
    selectRemoteKey: 'name',
    required: true,
    selectRemoteOptions: { type: 2 },
    asyncSelDataApi: search,
    asyncSelData: []
  },
  {
    label: '相反相畏',
    prop: 'other_id',
    isTable: true,
    isForm: true,
    formType: 'select_remote',
    selectRemoteKey: 'name',
    required: true,
    validatorRules: true,
    selectRemoteOptions: { type: 2 },
    asyncSelDataApi: search,
    asyncSelData: []
  },
  {
    label: '类型',
    prop: 'type',
    isTable: true,
    isForm: true,
    formType: 'radio',
    required: true,
    enum: DrugFearBackTypeEnum
  },
  {
    label: '创建时间',
    prop: 'created_at',
    isTable: true
  },
  {
    label: '创建人',
    prop: 'created_name',
    isTable: true
  },
  {
    label: '最近修改时间',
    prop: 'updated_at',
    isTable: true
  },
  {
    label: '最近修改人',
    prop: 'updated_name',
    isTable: true
  },
  {
    label: '状态',
    prop: 'status',
    isTable: true,
    formType: 'radio',
    defaultValue: 0,
    enum: StatusEnum
  },
  {
    label: '备注',
    prop: 'remark',
    isForm: true,
    formType: 'textarea',
    min: 0,
    max: 500
  }
]
const tableConfig = {
  buttons: ['view', 'edit', 'status']
}
const pageConfig = {
  small: false,
  disabled: false,
  background: false
}

export { tableColumn, tableConfig, pageConfig }
